using UnityEngine;

public class Timer
{
	private bool isAvailable;

	private float timeTarget;

	private float timeCurrent;

	public Timer(float timeTarget, bool isAvailable)
	{
		resetCurrentTime();
		setTargetTime(timeTarget);
		setAvailable(isAvailable);
	}

	public bool isReady()
	{
		if (isAvailable)
		{
			timeCurrent += Time.deltaTime;
			if (timeCurrent < timeTarget)
			{
				return false;
			}
			resetCurrentTime();
			return true;
		}
		return false;
	}

	public void resetCurrentTime()
	{
		timeCurrent = 0f;
	}

	public void setAvailable(bool _isAvailable)
	{
		isAvailable = _isAvailable;
	}

	public void setTargetTime(float _timeTarget)
	{
		timeTarget = _timeTarget;
	}
}
